﻿using MvcApplication.Entity;
using System.Data.Entity.ModelConfiguration;


namespace MvcApplication.Data.Mapping
{
    public class UserInfo_Mapping : EntityTypeConfiguration<UserInfo>
    {
        public UserInfo_Mapping()
        {
            this.HasKey(t => t.ID);
            this.ToTable("UserInfo");

            this.HasMany(t => t.Roles).WithMany().Map(m =>
            {
                m.ToTable("UserRole");
                m.MapLeftKey("RoleID");
                m.MapRightKey("UserID");
            });
        }
    }
}
